package com.wx.tgp.jfinal.demo.interceptor;


import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import com.jfinal.core.Controller;

/**
 * Created by Administrator on 2016/5/6.
 */
public class AuthInterceptor implements Interceptor{
    public void intercept(Invocation invocation){
        Controller controller = invocation.getController();
        Boolean loginUser = controller.getSessionAttr("flag");
        if(loginUser == true){
            invocation.invoke();
        }
        controller.redirect("/");
    }
}
